﻿using System;

using Fuse8.DomainFramework.BusinessService;

namespace Fuse8.ContentManagementFramework.Domain
{
    [Serializable]
    public partial class CmsEntityAnnotationComment : CmsTrackingEntityObject
    {
        #region Linked fields

        private CmsEntityAnnotation _annotation;

        #endregion

        #region Properties

        public virtual int AnnotationId { get; set; }
        
        public virtual string CommentText { get; set; }

        public virtual int OrderIndex { get; set; }

        #endregion

        #region Linked properties

        public CmsEntityAnnotation Annotation
        {
            get
            {
                if (_annotation == null)
                {
                    var businessFacade = new BusinessServiceFacade<CmsEntityAnnotation, int>();
                    
                    _annotation = businessFacade.FindOne(AnnotationId);
                }
                return _annotation;
            }
            set
            {
                AnnotationId = value != null ? value.Id : 0;

                _annotation = value;
            }
        }

        #endregion

        #region Constructor

        public CmsEntityAnnotationComment()
        { }

        #endregion
    }
}
